package org.example;
public class PhoneBill {
    private static final double RATE_UP_TO_20_MINUTES = 0.05;
    private static final double FIXED_RATE_OVER_20_MINUTES = 1.00;
    private static final double RATE_AFTER_20_MINUTES = 0.10;

    public double calculateBill(int duration) {
        if (duration <= 0) {
            throw new IllegalArgumentException("Duration must be greater than zero.");
        }

        if (duration <= 20) {
            return duration * RATE_UP_TO_20_MINUTES;
        } else {
            int extraMinutes = duration - 20;
            return FIXED_RATE_OVER_20_MINUTES + (extraMinutes * RATE_AFTER_20_MINUTES);
        }
    }
}


